#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
void mov(int* x, int n, int m)
{
    m = m % n;
    int a[10] = { 0 };
    for (int j = 0; j < n; j++)
    {
        a[j] = x[j];
    }
    int i;
    for (i = m; i < n; i++)
    {
        x[i] = a[i - m];
    }
    int t;
    for ( t = 0; t< m; i++, t++)
    {
        x[t] = a[i-m];
    }

}
int main()
{
    int n, m;
    scanf("%d %d", &n, &m);
    int x[10] = { 0 };
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &x[i]);
    }
    mov(x, n, m);
    printf("After move:");
    for (int j = 0; j < n; j++)
    {
        printf(" %d", x[j]);
    }
    return 0;
}